package cn.gson.springboot.model.pjos;

import cn.afterturn.easypoi.excel.annotation.Excel;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.List;
import java.util.Objects;

@Entity
public class Customer {
    private String cusName;
    private Timestamp cusOverTime;
    private String cusSource;
    private Integer cusEnd;
    private String cusRemark;
    private int customId;
    private String customXqinfo;
    private Emp customEmpid;
    private Integer cusState;
    private Timestamp customTime;
    private Integer cusDel;
    private CustomerType typeId;
    private String cusAddressProvince;
    private String cusAddressCity;
    private String cusAddressArea;
    private Integer attention;
    private List<BusinessInfo> businessInfosByCustomId;//商机
    private List<Competitor> competitorsByCustomId;//竞争对手
    private List<Complain> complainsByCustomId;//投诉
    private List<Contract> contractsByCustomId;//合同
    private List<Cuclue> cucluesByCustomId;//线索
    private List<Culinkman> culinkmenByCustomId;//联系人
    private List<Demand> demandsByCustomId;
    private List<Maintain> maintainsByCustomId;//维修
    private List<Offer> offersByCustomId;//报价
    private List<Programme> programmesByCustomId;//解决方案
    private List<Server> serversByCustomId;
    private List<Evection> evectionByCustomId;//出差
    private List<OrderInfo> orderInfoByCustomId;//订单
    @Basic
    @Column(name = "cus_name")
    public String getCusName() {
        return cusName;
    }

    public void setCusName(String cusName) {
        this.cusName = cusName;
    }

    @Basic
    @Column(name = "cus_over_time")
    public Timestamp getCusOverTime() {
        return cusOverTime;
    }

    public void setCusOverTime(Timestamp cusOverTime) {
        this.cusOverTime = cusOverTime;
    }

    @Basic
    @Column(name = "cus_source")
    public String getCusSource() {
        return cusSource;
    }

    public void setCusSource(String cusSource) {
        this.cusSource = cusSource;
    }

    @Basic
    @Column(name = "cus_end")
    public Integer getCusEnd() {
        return cusEnd;
    }

    public void setCusEnd(Integer cusEnd) {
        this.cusEnd = cusEnd;
    }

    @Basic
    @Column(name = "cus_remark")
    public String getCusRemark() {
        return cusRemark;
    }

    public void setCusRemark(String cusRemark) {
        this.cusRemark = cusRemark;
    }

    @Id
    @Column(name = "custom_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    public int getCustomId() {
        return customId;
    }

    public void setCustomId(int customId) {
        this.customId = customId;
    }

    @Basic
    @Column(name = "custom_xqinfo")
    public String getCustomXqinfo() {
        return customXqinfo;
    }

    public void setCustomXqinfo(String customXqinfo) {
        this.customXqinfo = customXqinfo;
    }

    @ManyToOne
    @JoinColumn(name = "custom_empid", referencedColumnName = "employees_id")
    public Emp getCustomEmpid() {
        return customEmpid;
    }

    public void setCustomEmpid(Emp customEmpid) {
        this.customEmpid = customEmpid;
    }

    @ManyToOne
    @JoinColumn(name = "type_id", referencedColumnName = "type_id")
    public CustomerType getTypeId() {
        return typeId;
    }

    public void setTypeId(CustomerType typeId) {
        this.typeId = typeId;
    }

    @Basic
    @Column(name = "cus_state")
    public Integer getCusState() {
        return cusState;
    }

    public void setCusState(Integer cusState) {
        this.cusState = cusState;
    }

    @Basic
    @Column(name = "custom_time")
    public Timestamp getCustomTime() {
        return customTime;
    }

    public void setCustomTime(Timestamp customTime) {
        this.customTime = customTime;
    }

    @Basic
    @Column(name = "cus_del")
    public Integer getCusDel() {
        return cusDel;
    }

    public void setCusDel(Integer cusDel) {
        this.cusDel = cusDel;
    }

    @Basic
    @Column(name = "cus_address_province")
    public String getCusAddressProvince() {
        return cusAddressProvince;
    }

    public void setCusAddressProvince(String cusAddressProvince) {
        this.cusAddressProvince = cusAddressProvince;
    }

    @Basic
    @Column(name = "cus_address_city")
    public String getCusAddressCity() {
        return cusAddressCity;
    }

    public void setCusAddressCity(String cusAddressCity) {
        this.cusAddressCity = cusAddressCity;
    }

    @Basic
    @Column(name = "cus_address_area")
    public String getCusAddressArea() {
        return cusAddressArea;
    }

    public void setCusAddressArea(String cusAddressArea) {
        this.cusAddressArea = cusAddressArea;
    }

    @Basic
    @Column(name = "attention")
    public Integer getAttention() {
        return attention;
    }

    public void setAttention(Integer attention) {
        this.attention = attention;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Customer customer = (Customer) o;
        return customId == customer.customId &&
                Objects.equals(cusName, customer.cusName) &&
                Objects.equals(cusOverTime, customer.cusOverTime) &&
                Objects.equals(cusSource, customer.cusSource) &&
                Objects.equals(cusEnd, customer.cusEnd) &&
                Objects.equals(cusRemark, customer.cusRemark) &&
                Objects.equals(customXqinfo, customer.customXqinfo) &&
                Objects.equals(customEmpid, customer.customEmpid) &&
                Objects.equals(cusState, customer.cusState);
    }

    @Override
    public int hashCode() {
        return Objects.hash(cusName, cusOverTime, cusSource, cusEnd, cusRemark, customId, customXqinfo, customEmpid, cusState);
    }

    @OneToMany(mappedBy = "customerByCustomId")
    public List<BusinessInfo> getBusinessInfosByCustomId() {
        return businessInfosByCustomId;
    }

    public void setBusinessInfosByCustomId(List<BusinessInfo> businessInfosByCustomId) {
        this.businessInfosByCustomId = businessInfosByCustomId;
    }

    @OneToMany(mappedBy = "customerByCustomId")
    public List<Competitor> getCompetitorsByCustomId() {
        return competitorsByCustomId;
    }

    public void setCompetitorsByCustomId(List<Competitor> competitorsByCustomId) {
        this.competitorsByCustomId = competitorsByCustomId;
    }

    @OneToMany(mappedBy = "customerByCustomId")
    public List<Complain> getComplainsByCustomId() {
        return complainsByCustomId;
    }

    public void setComplainsByCustomId(List<Complain> complainsByCustomId) {
        this.complainsByCustomId = complainsByCustomId;
    }

    @OneToMany(mappedBy = "customerByCustomId")
    public List<Contract> getContractsByCustomId() {
        return contractsByCustomId;
    }

    public void setContractsByCustomId(List<Contract> contractsByCustomId) {
        this.contractsByCustomId = contractsByCustomId;
    }

    @OneToMany(mappedBy = "customerByCustomId")
    public List<Cuclue> getCucluesByCustomId() {
        return cucluesByCustomId;
    }

    public void setCucluesByCustomId(List<Cuclue> cucluesByCustomId) {
        this.cucluesByCustomId = cucluesByCustomId;
    }

    @OneToMany(mappedBy = "customerByCustomId")
    public List<Culinkman> getCulinkmenByCustomId() {
        return culinkmenByCustomId;
    }

    public void setCulinkmenByCustomId(List<Culinkman> culinkmenByCustomId) {
        this.culinkmenByCustomId = culinkmenByCustomId;
    }

    @OneToMany(mappedBy = "customerByCustomId")
    public List<Demand> getDemandsByCustomId() {
        return demandsByCustomId;
    }

    public void setDemandsByCustomId(List<Demand> demandsByCustomId) {
        this.demandsByCustomId = demandsByCustomId;
    }

    @OneToMany(mappedBy = "customerByCustomId")
    public List<Maintain> getMaintainsByCustomId() {
        return maintainsByCustomId;
    }

    public void setMaintainsByCustomId(List<Maintain> maintainsByCustomId) {
        this.maintainsByCustomId = maintainsByCustomId;
    }

    @OneToMany(mappedBy = "customerByCustomId")
    public List<Offer> getOffersByCustomId() {
        return offersByCustomId;
    }

    public void setOffersByCustomId(List<Offer> offersByCustomId) {
        this.offersByCustomId = offersByCustomId;
    }

    @OneToMany(mappedBy = "customerByCustomId")
    public List<Programme> getProgrammesByCustomId() {
        return programmesByCustomId;
    }

    public void setProgrammesByCustomId(List<Programme> programmesByCustomId) {
        this.programmesByCustomId = programmesByCustomId;
    }

    @OneToMany(mappedBy = "customerByCustomId")
    public List<Server> getServersByCustomId() {
        return serversByCustomId;
    }

    public void setServersByCustomId(List<Server> serversByCustomId) {
        this.serversByCustomId = serversByCustomId;
    }

    @OneToMany(mappedBy = "customerByCustomId")
    public List<Evection> getEvectionByCustomId() {
        return evectionByCustomId;
    }

    public void setEvectionByCustomId(List<Evection> evectionByCustomId) {
        this.evectionByCustomId = evectionByCustomId;
    }

    @OneToMany(mappedBy = "customerByCustomId")
    public List<OrderInfo> getOrderInfoByCustomId() {
        return orderInfoByCustomId;
    }

    public void setOrderInfoByCustomId(List<OrderInfo> orderInfoByCustomId) {
        this.orderInfoByCustomId = orderInfoByCustomId;
    }

    @Override
    public String toString() {
        return "Customer{" +
                "cusName='" + cusName + '\'' +
                ", cusSource='" + cusSource + '\'' +
                ", cusEnd=" + cusEnd +
                ", cusRemark='" + cusRemark + '\'' +
                ", customXqinfo='" + customXqinfo + '\'' +
                ", customId=" + customId +
                ", customEmpid=" + customEmpid +
                ", cusState=" + cusState +
                ", typeId=" + typeId +
                ", cusAddressProvince='" + cusAddressProvince + '\'' +
                ", cusAddressCity='" + cusAddressCity + '\'' +
                ", cusAddressArea='" + cusAddressArea + '\'' +
                ", attention=" + attention +
                ", culinkmenByCustomId=" + culinkmenByCustomId +
                '}';
    }
}